package com.yztc.android_1024_02;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private TextView tv1,tv2,tv3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tv1 = (TextView) findViewById(R.id.tv_merchant);
        tv2 = (TextView) findViewById(R.id.tv_comment);
        tv3 = (TextView) findViewById(R.id.tv_other);


        tv1.post(new Runnable() {
            @Override
            public void run() {
                View view = getLayoutInflater().inflate(R.layout.view_pop,null,false);
                PopupWindow popupWindow = new PopupWindow(view, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
                popupWindow.showAsDropDown(tv1);
                //设置点击外部可以取消
                //popupWindow.setFocusable(true);
                //popupWindow.setTouchable(true);
                //popupWindow.setBackgroundDrawable(new ColorDrawable());
            }
        });


    }
}
